CC = mpicc
CFLAGS = -Wall -fopenmp

SRC = src
OBJ = obj
BIN = bin
INCLUDE = include

PROGRAM = ICMCTown

NP = 8
HOSTS = hosts

####### --- ########

all: ICMCTown.o compile

run:
	@mpirun --hostfile $(HOSTS) -np $(NP) $(BIN)/$(PROGRAM)

time:
	@/usr/bin/time -f "%e" mpirun -np $(NP) $(BIN)/$(PROGRAM) $(CFLAGS)

compile: 
	@$(CC) $(OBJ)/*.o -I $(INCLUDE) -o $(BIN)/$(PROGRAM) $(CFLAGS)
	@echo complete compilation

ICMCTown.o:
	@$(CC) -c $(SRC)/$(PROGRAM).c -o $(OBJ)/$(PROGRAM).o $(CFLAGS)
	@echo $(PROGRAM).o compiled

clear:
	@rm $(BIN)/* $(OBJ)/*.o
